package com.swt.gap.common.graph;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;
import java.util.Map;

/**
 * neo4j 格式 图数据结构, property 以map格式
 *
 * @author sx
 * @date 2019/9/18 14:58
 */
@ApiModel
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class GraphNeo4jVO {
    @ApiModelProperty(value = "结点")
    private List<Node> nodes;

    @ApiModelProperty(value = "关系")
    private List<Link> links;

    @ApiModel
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Node {
        @ApiModelProperty(value = "实体Id")
        private String id;

        @ApiModelProperty(value = "主键属性名")
        private String primaryKeyPropertyKey;

        @ApiModelProperty(value = "实体属性")
        private Map<String, Object> properties ;

//        @ApiModelProperty(value = "实体示的属性名")
//        private String displayPropertyKey;

//        @ApiModelProperty(value = "实体展示的值，此属性有值时无需使用displayPropertyKey")
//        private String displayValue;

        @ApiModelProperty(value = "图标")
        private String icon;

        @ApiModelProperty(value = "标签")
        private List<String> labels;

//        /**
//         * 固定坐标x
////         */
//        @ApiModelProperty(value = "固定坐标x")
//        private Double fx;
//        /**
//         * 固定坐标x
//         */
//        @ApiModelProperty(value = "固定坐标y")
//        private Double fy;
//
//        /**
//         * 坐标x
//         */
//        @ApiModelProperty(value = "坐标x")
//        private Double x;
//        /**
//         * 坐标x
//         */
//        @ApiModelProperty(value = "坐标y")
//        private Double y;

//        /**
//         * vx
//         */
//        @ApiModelProperty(value = "vx")
//        private Double vx;
//        /**
//         * vy
//         */
//        @ApiModelProperty(value = "vy")
//        private Double vy;

        /**
         * 入度
         */
//        @ApiModelProperty(value = "入度")
//        private Integer inDegree;
//        /**
//         * 出度
//         */
//        @ApiModelProperty(value = "出度")
//        private Integer outDegree;

//        @ApiModelProperty(value = "是否空值")
//        private Boolean isEmpty;

//        @ApiModelProperty(value = "交易金额，非必须")
//        private Double amount;

        @ApiModelProperty(value = "名称")
        private String name;
    }

    @ApiModel
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Link {
        @ApiModelProperty(value = "关系id")
        private String id;

        @ApiModelProperty(value = "起始实体Id")
        private String startNodeId;

        @ApiModelProperty(value = "终止实体id")
        private String endNodeId;

        @ApiModelProperty(value = "关系类型")
        private String type;

        @ApiModelProperty(value = "方向, 1正向，2反向")
        private Integer direction;

        @ApiModelProperty(value = "关系属性")
        private Map<String, Object> properties;

//        @ApiModelProperty(value = "source结点")
//        private Node source;
//
//        @ApiModelProperty(value = "target结点")
//        private Node target;

        @ApiModelProperty(value = "颜色")
        private String color;

        @ApiModelProperty(value = "粗细")
        private String width;

        @ApiModelProperty(value = "显示的属性的key")
        private String displayPropertyKey;

        @ApiModelProperty(value = "合并类型")
        private String mergeType;

        @ApiModelProperty(value = "本体关系id")
        private Integer ontologyRelationshipId;

        @ApiModelProperty(value = "权重")
        private Integer weight;
    }
    @ApiModel
    @Data
    public static class Property {
        @ApiModelProperty(value = "属性名")
        private String key;

        @ApiModelProperty(value = "属性值")
        private String value;
    }
}
